<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- qstandarditemmodel.cpp -->
  <title>QStandardItemModel Class | Qt GUI 5.14.2</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="../qtdoc/index.html">Qt 5.14</a></td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QStandardItemModel</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.14.2 Reference Documentation</a></td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#properties">Properties</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#reimplemented-public-functions">Reimplemented Public Functions</a></li>
<li class="level1"><a href="#signals">Signals</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QStandardItemModel Class</h1>
<!-- $$$QStandardItemModel-brief -->
<p>The QStandardItemModel class provides a generic model for storing custom data. <a href="#details">More...</a></p>
<!-- @@@QStandardItemModel -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QStandardItemModel&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a></td></tr></table></div><ul>
<li><a href="qstandarditemmodel-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="properties"></a>
<h2 id="properties">Properties</h2>
<ul>
<li class="fn"><b><a href="qstandarditemmodel.html#sortRole-prop">sortRole</a></b> : int</li>
</ul>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#QStandardItemModel-1">QStandardItemModel</a></b>(int <i>rows</i>, int <i>columns</i>, QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#QStandardItemModel">QStandardItemModel</a></b>(QObject *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#dtor.QStandardItemModel">~QStandardItemModel</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#appendColumn">appendColumn</a></b>(const QList&lt;QStandardItem *&gt; &amp;<i>items</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#appendRow">appendRow</a></b>(const QList&lt;QStandardItem *&gt; &amp;<i>items</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#appendRow-1">appendRow</a></b>(QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#clear">clear</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#clearItemData">clearItemData</a></b>(const QModelIndex &amp;<i>index</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QStandardItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#findItems">findItems</a></b>(const QString &amp;<i>text</i>, Qt::MatchFlags <i>flags</i> = Qt::MatchExactly, int <i>column</i> = 0) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#horizontalHeaderItem">horizontalHeaderItem</a></b>(int <i>column</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#indexFromItem">indexFromItem</a></b>(const QStandardItem *<i>item</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertColumn">insertColumn</a></b>(int <i>column</i>, const QList&lt;QStandardItem *&gt; &amp;<i>items</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertColumn-1">insertColumn</a></b>(int <i>column</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertRow">insertRow</a></b>(int <i>row</i>, const QList&lt;QStandardItem *&gt; &amp;<i>items</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertRow-1">insertRow</a></b>(int <i>row</i>, QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertRow-2">insertRow</a></b>(int <i>row</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#invisibleRootItem">invisibleRootItem</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#item">item</a></b>(int <i>row</i>, int <i>column</i> = 0) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a></b>(const QModelIndex &amp;<i>index</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> const QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#itemPrototype">itemPrototype</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setColumnCount">setColumnCount</a></b>(int <i>columns</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setHorizontalHeaderItem">setHorizontalHeaderItem</a></b>(int <i>column</i>, QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setHorizontalHeaderLabels">setHorizontalHeaderLabels</a></b>(const QStringList &amp;<i>labels</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setItem">setItem</a></b>(int <i>row</i>, int <i>column</i>, QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setItem-1">setItem</a></b>(int <i>row</i>, QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setItemPrototype">setItemPrototype</a></b>(const QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setItemRoleNames">setItemRoleNames</a></b>(const QHash&lt;int, QByteArray&gt; &amp;<i>roleNames</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setRowCount">setRowCount</a></b>(int <i>rows</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#sortRole-prop">setSortRole</a></b>(int <i>role</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setVerticalHeaderItem">setVerticalHeaderItem</a></b>(int <i>row</i>, QStandardItem *<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setVerticalHeaderLabels">setVerticalHeaderLabels</a></b>(const QStringList &amp;<i>labels</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#sortRole-prop">sortRole</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QStandardItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#takeColumn">takeColumn</a></b>(int <i>column</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#takeHorizontalHeaderItem">takeHorizontalHeaderItem</a></b>(int <i>column</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#takeItem">takeItem</a></b>(int <i>row</i>, int <i>column</i> = 0)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QList&lt;QStandardItem *&gt; </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#takeRow">takeRow</a></b>(int <i>row</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#takeVerticalHeaderItem">takeVerticalHeaderItem</a></b>(int <i>row</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#verticalHeaderItem">verticalHeaderItem</a></b>(int <i>row</i>) const</td></tr>
</table></div>
<a name="reimplemented-public-functions"></a>
<h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#columnCount">columnCount</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#data">data</a></b>(const QModelIndex &amp;<i>index</i>, int <i>role</i> = Qt::DisplayRole) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#dropMimeData">dropMimeData</a></b>(const QMimeData *<i>data</i>, Qt::DropAction <i>action</i>, int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>parent</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::ItemFlags </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#flags">flags</a></b>(const QModelIndex &amp;<i>index</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#hasChildren">hasChildren</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#headerData">headerData</a></b>(int <i>section</i>, Qt::Orientation <i>orientation</i>, int <i>role</i> = Qt::DisplayRole) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#index">index</a></b>(int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertColumns">insertColumns</a></b>(int <i>column</i>, int <i>count</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#insertRows">insertRows</a></b>(int <i>row</i>, int <i>count</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QMap&lt;int, QVariant&gt; </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#itemData">itemData</a></b>(const QModelIndex &amp;<i>index</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QMimeData *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#mimeData">mimeData</a></b>(const QModelIndexList &amp;<i>indexes</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QStringList </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#mimeTypes">mimeTypes</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#parent">parent</a></b>(const QModelIndex &amp;<i>child</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#removeColumns">removeColumns</a></b>(int <i>column</i>, int <i>count</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#removeRows">removeRows</a></b>(int <i>row</i>, int <i>count</i>, const QModelIndex &amp;<i>parent</i> = QModelIndex()) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#rowCount">rowCount</a></b>(const QModelIndex &amp;<i>parent</i> = QModelIndex()) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setData">setData</a></b>(const QModelIndex &amp;<i>index</i>, const QVariant &amp;<i>value</i>, int <i>role</i> = Qt::EditRole) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setHeaderData">setHeaderData</a></b>(int <i>section</i>, Qt::Orientation <i>orientation</i>, const QVariant &amp;<i>value</i>, int <i>role</i> = Qt::EditRole) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#setItemData">setItemData</a></b>(const QModelIndex &amp;<i>index</i>, const QMap&lt;int, QVariant&gt; &amp;<i>roles</i>) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#sibling">sibling</a></b>(int <i>row</i>, int <i>column</i>, const QModelIndex &amp;<i>idx</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#sort">sort</a></b>(int <i>column</i>, Qt::SortOrder <i>order</i> = Qt::AscendingOrder) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::DropActions </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#supportedDropActions">supportedDropActions</a></b>() const override</td></tr>
</table></div>
<a name="signals"></a>
<h2 id="signals">Signals</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditemmodel.html#itemChanged">itemChanged</a></b>(QStandardItem *<i>item</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QStandardItemModel-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>QStandardItemModel can be used as a repository for standard Qt data types. It is one of the <a href="../qtwidgets/model-view-programming.html#model-view-classes">Model/View Classes</a> and is part of Qt's <a href="../qtwidgets/model-view-programming.html">model/view</a> framework.</p>
<p>QStandardItemModel provides a classic item-based approach to working with the model. The items in a QStandardItemModel are provided by <a href="qstandarditem.html">QStandardItem</a>.</p>
<p>QStandardItemModel implements the <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> interface, which means that the model can be used to provide data in any view that supports that interface (such as <a href="../qtwidgets/qlistview.html">QListView</a>, <a href="../qtwidgets/qtableview.html">QTableView</a> and <a href="../qtwidgets/qtreeview.html">QTreeView</a>, and your own custom views). For performance and flexibility, you may want to subclass <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> to provide support for different kinds of data repositories. For example, the QDirModel provides a model interface to the underlying file system.</p>
<p>When you want a list or tree, you typically create an empty QStandardItemModel and use <a href="qstandarditemmodel.html#appendRow">appendRow</a>() to add items to the model, and <a href="qstandarditemmodel.html#item">item</a>() to access an item. If your model represents a table, you typically pass the dimensions of the table to the QStandardItemModel constructor and use <a href="qstandarditemmodel.html#setItem">setItem</a>() to position items into the table. You can also use <a href="qstandarditemmodel.html#setRowCount">setRowCount</a>() and <a href="qstandarditemmodel.html#setColumnCount">setColumnCount</a>() to alter the dimensions of the model. To insert items, use <a href="qstandarditemmodel.html#insertRow">insertRow</a>() or <a href="qstandarditemmodel.html#insertColumn">insertColumn</a>(), and to remove items, use <a href="../qtcore/qabstractitemmodel.html#removeRow">removeRow</a>() or <a href="../qtcore/qabstractitemmodel.html#removeColumn">removeColumn</a>().</p>
<p>You can set the header labels of your model with <a href="qstandarditemmodel.html#setHorizontalHeaderLabels">setHorizontalHeaderLabels</a>() and <a href="qstandarditemmodel.html#setVerticalHeaderLabels">setVerticalHeaderLabels</a>().</p>
<p>You can search for items in the model with <a href="qstandarditemmodel.html#findItems">findItems</a>(), and sort the model by calling <a href="qstandarditemmodel.html#sort">sort</a>().</p>
<p>Call <a href="qstandarditemmodel.html#clear">clear</a>() to remove all items from the model.</p>
<p>An example usage of QStandardItemModel to create a table:</p>
<pre class="cpp">

  <span class="type"><a href="qstandarditemmodel.html#QStandardItemModel">QStandardItemModel</a></span> model(<span class="number">4</span><span class="operator">,</span> <span class="number">4</span>);
  <span class="keyword">for</span> (<span class="type">int</span> row <span class="operator">=</span> <span class="number">0</span>; row <span class="operator">&lt;</span> model<span class="operator">.</span>rowCount(); <span class="operator">+</span><span class="operator">+</span>row) {
      <span class="keyword">for</span> (<span class="type">int</span> column <span class="operator">=</span> <span class="number">0</span>; column <span class="operator">&lt;</span> model<span class="operator">.</span>columnCount(); <span class="operator">+</span><span class="operator">+</span>column) {
          <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> <span class="operator">*</span>item <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstandarditem.html">QStandardItem</a></span>(<span class="type"><a href="../qtcore/qstring.html">QString</a></span>(<span class="string">&quot;row %0, column %1&quot;</span>)<span class="operator">.</span>arg(row)<span class="operator">.</span>arg(column));
          model<span class="operator">.</span>setItem(row<span class="operator">,</span> column<span class="operator">,</span> item);
      }
  }

</pre>
<p>An example usage of QStandardItemModel to create a tree:</p>
<pre class="cpp">

  <span class="type"><a href="qstandarditemmodel.html#QStandardItemModel">QStandardItemModel</a></span> model;
  <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> <span class="operator">*</span>parentItem <span class="operator">=</span> model<span class="operator">.</span>invisibleRootItem();
  <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> <span class="number">4</span>; <span class="operator">+</span><span class="operator">+</span>i) {
      <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> <span class="operator">*</span>item <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="qstandarditem.html">QStandardItem</a></span>(<span class="type"><a href="../qtcore/qstring.html">QString</a></span>(<span class="string">&quot;item %0&quot;</span>)<span class="operator">.</span>arg(i));
      parentItem<span class="operator">-</span><span class="operator">&gt;</span>appendRow(item);
      parentItem <span class="operator">=</span> item;
  }

</pre>
<p>After setting the model on a view, you typically want to react to user actions, such as an item being clicked. Since a <a href="../qtwidgets/qabstractitemview.html">QAbstractItemView</a> provides <a href="../qtcore/qmodelindex.html">QModelIndex</a>-based signals and functions, you need a way to obtain the <a href="qstandarditem.html">QStandardItem</a> that corresponds to a given <a href="../qtcore/qmodelindex.html">QModelIndex</a>, and vice versa. <a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a>() and <a href="qstandarditemmodel.html#indexFromItem">indexFromItem</a>() provide this mapping. Typical usage of <a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a>() includes obtaining the item at the current index in a view, and obtaining the item that corresponds to an index carried by a <a href="../qtwidgets/qabstractitemview.html">QAbstractItemView</a> signal, such as <a href="../qtwidgets/qabstractitemview.html#clicked">QAbstractItemView::clicked</a>(). First you connect the view's signal to a slot in your class:</p>
<pre class="cpp">

  <span class="type"><a href="../qtwidgets/qtreeview.html">QTreeView</a></span> <span class="operator">*</span>treeView <span class="operator">=</span> <span class="keyword">new</span> <span class="type"><a href="../qtwidgets/qtreeview.html">QTreeView</a></span>(<span class="keyword">this</span>);
  treeView<span class="operator">-</span><span class="operator">&gt;</span>setModel(myStandardItemModel);
  connect(treeView<span class="operator">,</span> <span class="operator">&amp;</span><span class="type"><a href="../qtwidgets/qtreeview.html">QTreeView</a></span><span class="operator">::</span>clicked<span class="operator">,</span>
          <span class="keyword">this</span><span class="operator">,</span> <span class="operator">&amp;</span>MyWidget<span class="operator">::</span>clicked);

</pre>
<p>When you receive the signal, you call <a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a>() on the given model index to get a pointer to the item:</p>
<pre class="cpp">

  <span class="type">void</span> MyWidget<span class="operator">::</span>clicked(<span class="keyword">const</span> <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> <span class="operator">&amp;</span>index)
  {
      <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> <span class="operator">*</span>item <span class="operator">=</span> myStandardItemModel<span class="operator">-</span><span class="operator">&gt;</span>itemFromIndex(index);
      <span class="comment">// Do stuff with the item ...</span>
  }

</pre>
<p>Conversely, you must obtain the <a href="../qtcore/qmodelindex.html">QModelIndex</a> of an item when you want to invoke a model/view function that takes an index as argument. You can obtain the index either by using the model's <a href="qstandarditemmodel.html#indexFromItem">indexFromItem</a>() function, or, equivalently, by calling <a href="qstandarditem.html#index">QStandardItem::index</a>():</p>
<pre class="cpp">

  treeView<span class="operator">-</span><span class="operator">&gt;</span>scrollTo(item<span class="operator">-</span><span class="operator">&gt;</span>index());

</pre>
<p>You are, of course, not required to use the item-based approach; you could instead rely entirely on the <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a> interface when working with the model, or use a combination of the two as appropriate.</p>
</div>
<p><b>See also </b><a href="qstandarditem.html">QStandardItem</a>, <a href="../qtwidgets/model-view-programming.html">Model/View Programming</a>, <a href="../qtcore/qabstractitemmodel.html">QAbstractItemModel</a>, <a href="../qtwidgets/qtwidgets-itemviews-simpletreemodel-example.html">Simple Tree Model example</a>, and <a href="../qtwidgets/model-view-programming.html#item-view-convenience-classes">Item View Convenience Classes</a>.</p>
<!-- @@@QStandardItemModel -->
<div class="prop">
<h2>Property Documentation</h2>
<!-- $$$sortRole-prop$$$sortRole$$$setSortRoleint -->
<h3 class="fn" id="sortRole-prop"><a name="sortRole-prop"></a><span class="name">sortRole</span> : <span class="type">int</span></h3>
<p>This property holds the item role that is used to query the model's data when sorting items</p>
<p>The default value is <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::DisplayRole</a>.</p>
<p>This property was introduced in Qt 4.2.</p>
<p><b>Access functions:</b></p>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft topAlign rightAlign"> int </td><td class="memItemRight bottomAlign"><span class="name"><b>sortRole</b></span>() const</td></tr>
<tr><td class="memItemLeft topAlign rightAlign"> void </td><td class="memItemRight bottomAlign"><span class="name"><b>setSortRole</b></span>(int <i>role</i>)</td></tr>
</table></div>
<p><b>See also </b><a href="qstandarditemmodel.html#sort">sort</a>() and <a href="qstandarditem.html#sortChildren">QStandardItem::sortChildren</a>().</p>
<!-- @@@sortRole -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QStandardItemModel$$$QStandardItemModelintintQObject* -->
<h3 class="fn" id="QStandardItemModel-1"><a name="QStandardItemModel-1"></a>QStandardItemModel::<span class="name">QStandardItemModel</span>(<span class="type">int</span> <i>rows</i>, <span class="type">int</span> <i>columns</i>, <span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a new item model that initially has <i>rows</i> rows and <i>columns</i> columns, and that has the given <i>parent</i>.</p>
<!-- @@@QStandardItemModel -->
<!-- $$$QStandardItemModel[overload1]$$$QStandardItemModelQObject* -->
<h3 class="fn" id="QStandardItemModel"><a name="QStandardItemModel"></a>QStandardItemModel::<span class="name">QStandardItemModel</span>(<span class="type"><a href="../qtcore/qobject.html#QObject">QObject</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a new item model with the given <i>parent</i>.</p>
<!-- @@@QStandardItemModel -->
<!-- $$$itemChanged[overload1]$$$itemChangedQStandardItem* -->
<h3 class="fn" id="itemChanged"><a name="itemChanged"></a><code>[signal] </code><span class="type">void</span> QStandardItemModel::<span class="name">itemChanged</span>(<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>This signal is emitted whenever the data of <i>item</i> has changed.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@itemChanged -->
<!-- $$$~QStandardItemModel[overload1]$$$~QStandardItemModel -->
<h3 class="fn" id="dtor.QStandardItemModel"><a name="dtor.QStandardItemModel"></a><code>[virtual] </code>QStandardItemModel::<span class="name">~QStandardItemModel</span>()</h3>
<p>Destructs the model. The model destroys all its items.</p>
<!-- @@@~QStandardItemModel -->
<!-- $$$appendColumn[overload1]$$$appendColumnconstQList<QStandardItem*>& -->
<h3 class="fn" id="appendColumn"><a name="appendColumn"></a><span class="type">void</span> QStandardItemModel::<span class="name">appendColumn</span>(const <span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; &amp;<i>items</i>)</h3>
<p>Appends a column containing <i>items</i>. If necessary, the row count is increased to the size of <i>items</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#insertColumn">insertColumn</a>() and <a href="qstandarditemmodel.html#appendRow">appendRow</a>().</p>
<!-- @@@appendColumn -->
<!-- $$$appendRow[overload1]$$$appendRowconstQList<QStandardItem*>& -->
<h3 class="fn" id="appendRow"><a name="appendRow"></a><span class="type">void</span> QStandardItemModel::<span class="name">appendRow</span>(const <span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; &amp;<i>items</i>)</h3>
<p>Appends a row containing <i>items</i>. If necessary, the column count is increased to the size of <i>items</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#insertRow">insertRow</a>() and <a href="qstandarditemmodel.html#appendColumn">appendColumn</a>().</p>
<!-- @@@appendRow -->
<!-- $$$appendRow$$$appendRowQStandardItem* -->
<h3 class="fn" id="appendRow-1"><a name="appendRow-1"></a><span class="type">void</span> QStandardItemModel::<span class="name">appendRow</span>(<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>This is an overloaded function.</p>
<p>When building a list or a tree that has only one column, this function provides a convenient way to append a single new <i>item</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@appendRow -->
<!-- $$$clear[overload1]$$$clear -->
<h3 class="fn" id="clear"><a name="clear"></a><span class="type">void</span> QStandardItemModel::<span class="name">clear</span>()</h3>
<p>Removes all items (including header items) from the model and sets the number of rows and columns to zero.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#removeColumns">removeColumns</a>() and <a href="qstandarditemmodel.html#removeRows">removeRows</a>().</p>
<!-- @@@clear -->
<!-- $$$clearItemData[overload1]$$$clearItemDataconstQModelIndex& -->
<h3 class="fn" id="clearItemData"><a name="clearItemData"></a><span class="type">bool</span> QStandardItemModel::<span class="name">clearItemData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>)</h3>
<p>Removes the data stored in all the roles for the given <i>index</i>. Returns <code>true</code> if <i>index</i> is valid and data was cleared, <code>false</code> otherwise.</p>
<p>This function was introduced in Qt 5.12.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setData">setData</a>() and <a href="qstandarditemmodel.html#data">data</a>().</p>
<!-- @@@clearItemData -->
<!-- $$$columnCount[overload1]$$$columnCountconstQModelIndex& -->
<h3 class="fn" id="columnCount"><a name="columnCount"></a><code>[override virtual] </code><span class="type">int</span> QStandardItemModel::<span class="name">columnCount</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#columnCount">QAbstractItemModel::columnCount</a>(const QModelIndex &amp;parent) const.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setColumnCount">setColumnCount</a>().</p>
<!-- @@@columnCount -->
<!-- $$$data[overload1]$$$dataconstQModelIndex&int -->
<h3 class="fn" id="data"><a name="data"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QStandardItemModel::<span class="name">data</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>, <span class="type">int</span> <i>role</i> = Qt::DisplayRole) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#data">QAbstractItemModel::data</a>(const QModelIndex &amp;index, int role) const.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setData">setData</a>().</p>
<!-- @@@data -->
<!-- $$$dropMimeData[overload1]$$$dropMimeDataconstQMimeData*Qt::DropActionintintconstQModelIndex& -->
<h3 class="fn" id="dropMimeData"><a name="dropMimeData"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">dropMimeData</span>(const <span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span> *<i>data</i>, <span class="type"><a href="../qtcore/qt.html#DropAction-enum">Qt::DropAction</a></span> <i>action</i>, <span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i>)</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#dropMimeData">QAbstractItemModel::dropMimeData</a>(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &amp;parent).</p>
<!-- @@@dropMimeData -->
<!-- $$$findItems[overload1]$$$findItemsconstQString&Qt::MatchFlagsint -->
<h3 class="fn" id="findItems"><a name="findItems"></a><span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; QStandardItemModel::<span class="name">findItems</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="../qtcore/qt.html#MatchFlag-enum">Qt::MatchFlags</a></span> <i>flags</i> = Qt::MatchExactly, <span class="type">int</span> <i>column</i> = 0) const</h3>
<p>Returns a list of items that match the given <i>text</i>, using the given <i>flags</i>, in the given <i>column</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@findItems -->
<!-- $$$flags[overload1]$$$flagsconstQModelIndex& -->
<h3 class="fn" id="flags"><a name="flags"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a></span> QStandardItemModel::<span class="name">flags</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#flags">QAbstractItemModel::flags</a>(const QModelIndex &amp;index) const.</p>
<!-- @@@flags -->
<!-- $$$hasChildren[overload1]$$$hasChildrenconstQModelIndex& -->
<h3 class="fn" id="hasChildren"><a name="hasChildren"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">hasChildren</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#hasChildren">QAbstractItemModel::hasChildren</a>(const QModelIndex &amp;parent) const.</p>
<!-- @@@hasChildren -->
<!-- $$$headerData[overload1]$$$headerDataintQt::Orientationint -->
<h3 class="fn" id="headerData"><a name="headerData"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QStandardItemModel::<span class="name">headerData</span>(<span class="type">int</span> <i>section</i>, <span class="type"><a href="../qtcore/qt.html#Orientation-enum">Qt::Orientation</a></span> <i>orientation</i>, <span class="type">int</span> <i>role</i> = Qt::DisplayRole) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#headerData">QAbstractItemModel::headerData</a>(int section, Qt::Orientation orientation, int role) const.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setHeaderData">setHeaderData</a>().</p>
<!-- @@@headerData -->
<!-- $$$horizontalHeaderItem[overload1]$$$horizontalHeaderItemint -->
<h3 class="fn" id="horizontalHeaderItem"><a name="horizontalHeaderItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">horizontalHeaderItem</span>(<span class="type">int</span> <i>column</i>) const</h3>
<p>Returns the horizontal header item for <i>column</i> if one has been set; otherwise returns <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setHorizontalHeaderItem">setHorizontalHeaderItem</a>() and <a href="qstandarditemmodel.html#verticalHeaderItem">verticalHeaderItem</a>().</p>
<!-- @@@horizontalHeaderItem -->
<!-- $$$index[overload1]$$$indexintintconstQModelIndex& -->
<h3 class="fn" id="index"><a name="index"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QStandardItemModel::<span class="name">index</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#index">QAbstractItemModel::index</a>(int row, int column, const QModelIndex &amp;parent) const.</p>
<!-- @@@index -->
<!-- $$$indexFromItem[overload1]$$$indexFromItemconstQStandardItem* -->
<h3 class="fn" id="indexFromItem"><a name="indexFromItem"></a><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QStandardItemModel::<span class="name">indexFromItem</span>(const <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>) const</h3>
<p>Returns the <a href="../qtcore/qmodelindex.html">QModelIndex</a> associated with the given <i>item</i>.</p>
<p>Use this function when you want to perform an operation that requires the <a href="../qtcore/qmodelindex.html">QModelIndex</a> of the item, such as <a href="../qtwidgets/qabstractitemview.html#scrollTo">QAbstractItemView::scrollTo</a>(). <a href="qstandarditem.html#index">QStandardItem::index</a>() is provided as convenience; it is equivalent to calling this function.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a>() and <a href="qstandarditem.html#index">QStandardItem::index</a>().</p>
<!-- @@@indexFromItem -->
<!-- $$$insertColumn[overload1]$$$insertColumnintconstQList<QStandardItem*>& -->
<h3 class="fn" id="insertColumn"><a name="insertColumn"></a><span class="type">void</span> QStandardItemModel::<span class="name">insertColumn</span>(<span class="type">int</span> <i>column</i>, const <span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; &amp;<i>items</i>)</h3>
<p>Inserts a column at <i>column</i> containing <i>items</i>. If necessary, the row count is increased to the size of <i>items</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#takeColumn">takeColumn</a>(), <a href="qstandarditemmodel.html#appendColumn">appendColumn</a>(), and <a href="qstandarditemmodel.html#insertRow">insertRow</a>().</p>
<!-- @@@insertColumn -->
<!-- $$$insertColumn$$$insertColumnintconstQModelIndex& -->
<h3 class="fn" id="insertColumn-1"><a name="insertColumn-1"></a><span class="type">bool</span> QStandardItemModel::<span class="name">insertColumn</span>(<span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Inserts a single column before the given <i>column</i> in the child items of the <i>parent</i> specified. Returns <code>true</code> if the column is inserted; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#insertColumns">insertColumns</a>(), <a href="qstandarditemmodel.html#insertRow">insertRow</a>(), and <a href="../qtcore/qabstractitemmodel.html#removeColumn">removeColumn</a>().</p>
<!-- @@@insertColumn -->
<!-- $$$insertColumns[overload1]$$$insertColumnsintintconstQModelIndex& -->
<h3 class="fn" id="insertColumns"><a name="insertColumns"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">insertColumns</span>(<span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#insertColumns">QAbstractItemModel::insertColumns</a>(int column, int count, const QModelIndex &amp;parent).</p>
<!-- @@@insertColumns -->
<!-- $$$insertRow[overload1]$$$insertRowintconstQList<QStandardItem*>& -->
<h3 class="fn" id="insertRow"><a name="insertRow"></a><span class="type">void</span> QStandardItemModel::<span class="name">insertRow</span>(<span class="type">int</span> <i>row</i>, const <span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; &amp;<i>items</i>)</h3>
<p>Inserts a row at <i>row</i> containing <i>items</i>. If necessary, the column count is increased to the size of <i>items</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#takeRow">takeRow</a>(), <a href="qstandarditemmodel.html#appendRow">appendRow</a>(), and <a href="qstandarditemmodel.html#insertColumn">insertColumn</a>().</p>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintQStandardItem* -->
<h3 class="fn" id="insertRow-1"><a name="insertRow-1"></a><span class="type">void</span> QStandardItemModel::<span class="name">insertRow</span>(<span class="type">int</span> <i>row</i>, <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>This is an overloaded function.</p>
<p>Inserts a row at <i>row</i> containing <i>item</i>.</p>
<p>When building a list or a tree that has only one column, this function provides a convenient way to append a single new item.</p>
<p>This function was introduced in Qt 4.2.</p>
<!-- @@@insertRow -->
<!-- $$$insertRow$$$insertRowintconstQModelIndex& -->
<h3 class="fn" id="insertRow-2"><a name="insertRow-2"></a><span class="type">bool</span> QStandardItemModel::<span class="name">insertRow</span>(<span class="type">int</span> <i>row</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Inserts a single row before the given <i>row</i> in the child items of the <i>parent</i> specified. Returns <code>true</code> if the row is inserted; otherwise returns <code>false</code>.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#insertRows">insertRows</a>(), <a href="qstandarditemmodel.html#insertColumn">insertColumn</a>(), and <a href="../qtcore/qabstractitemmodel.html#removeRow">removeRow</a>().</p>
<!-- @@@insertRow -->
<!-- $$$insertRows[overload1]$$$insertRowsintintconstQModelIndex& -->
<h3 class="fn" id="insertRows"><a name="insertRows"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">insertRows</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#insertRows">QAbstractItemModel::insertRows</a>(int row, int count, const QModelIndex &amp;parent).</p>
<!-- @@@insertRows -->
<!-- $$$invisibleRootItem[overload1]$$$invisibleRootItem -->
<h3 class="fn" id="invisibleRootItem"><a name="invisibleRootItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">invisibleRootItem</span>() const</h3>
<p>Returns the model's invisible root item.</p>
<p>The invisible root item provides access to the model's top-level items through the <a href="qstandarditem.html">QStandardItem</a> API, making it possible to write functions that can treat top-level items and their children in a uniform way; for example, recursive functions involving a tree model.</p>
<p><b>Note: </b>Calling <a href="../qtcore/qabstractitemmodel.html#index">index()</a> on the <a href="qstandarditem.html">QStandardItem</a> object retrieved from this function is not valid.</p><p>This function was introduced in Qt 4.2.</p>
<!-- @@@invisibleRootItem -->
<!-- $$$item[overload1]$$$itemintint -->
<h3 class="fn" id="item"><a name="item"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">item</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i> = 0) const</h3>
<p>Returns the item for the given <i>row</i> and <i>column</i> if one has been set; otherwise returns <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setItem">setItem</a>(), <a href="qstandarditemmodel.html#takeItem">takeItem</a>(), and <a href="qstandarditemmodel.html#itemFromIndex">itemFromIndex</a>().</p>
<!-- @@@item -->
<!-- $$$itemData[overload1]$$$itemDataconstQModelIndex& -->
<h3 class="fn" id="itemData"><a name="itemData"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmap.html">QMap</a></span>&lt;<span class="type">int</span>, <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>&gt; QStandardItemModel::<span class="name">itemData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#itemData">QAbstractItemModel::itemData</a>(const QModelIndex &amp;index) const.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setItemData">setItemData</a>().</p>
<!-- @@@itemData -->
<!-- $$$itemFromIndex[overload1]$$$itemFromIndexconstQModelIndex& -->
<h3 class="fn" id="itemFromIndex"><a name="itemFromIndex"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">itemFromIndex</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>) const</h3>
<p>Returns a pointer to the <a href="qstandarditem.html">QStandardItem</a> associated with the given <i>index</i>.</p>
<p>Calling this function is typically the initial step when processing <a href="../qtcore/qmodelindex.html">QModelIndex</a>-based signals from a view, such as <a href="../qtwidgets/qabstractitemview.html#activated">QAbstractItemView::activated</a>(). In your slot, you call itemFromIndex(), with the <a href="../qtcore/qmodelindex.html">QModelIndex</a> carried by the signal as argument, to obtain a pointer to the corresponding <a href="qstandarditem.html">QStandardItem</a>.</p>
<p>Note that this function will lazily create an item for the index (using <a href="qstandarditemmodel.html#itemPrototype">itemPrototype</a>()), and set it in the parent item's child table, if no item already exists at that index.</p>
<p>If <i>index</i> is an invalid index, this function returns <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#indexFromItem">indexFromItem</a>().</p>
<!-- @@@itemFromIndex -->
<!-- $$$itemPrototype[overload1]$$$itemPrototype -->
<h3 class="fn" id="itemPrototype"><a name="itemPrototype"></a>const <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">itemPrototype</span>() const</h3>
<p>Returns the item prototype used by the model. The model uses the item prototype as an item factory when it needs to construct new items on demand (for instance, when a view or item delegate calls <a href="qstandarditemmodel.html#setData">setData</a>()).</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setItemPrototype">setItemPrototype</a>().</p>
<!-- @@@itemPrototype -->
<!-- $$$mimeData[overload1]$$$mimeDataconstQModelIndexList& -->
<h3 class="fn" id="mimeData"><a name="mimeData"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmimedata.html">QMimeData</a></span> *QStandardItemModel::<span class="name">mimeData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html#QModelIndexList-typedef">QModelIndexList</a></span> &amp;<i>indexes</i>) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#mimeData">QAbstractItemModel::mimeData</a>(const QModelIndexList &amp;indexes) const.</p>
<!-- @@@mimeData -->
<!-- $$$mimeTypes[overload1]$$$mimeTypes -->
<h3 class="fn" id="mimeTypes"><a name="mimeTypes"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> QStandardItemModel::<span class="name">mimeTypes</span>() const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#mimeTypes">QAbstractItemModel::mimeTypes</a>() const.</p>
<!-- @@@mimeTypes -->
<!-- $$$parent[overload1]$$$parentconstQModelIndex& -->
<h3 class="fn" id="parent"><a name="parent"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QStandardItemModel::<span class="name">parent</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>child</i>) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#parent">QAbstractItemModel::parent</a>(const QModelIndex &amp;index) const.</p>
<!-- @@@parent -->
<!-- $$$removeColumns[overload1]$$$removeColumnsintintconstQModelIndex& -->
<h3 class="fn" id="removeColumns"><a name="removeColumns"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">removeColumns</span>(<span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#removeColumns">QAbstractItemModel::removeColumns</a>(int column, int count, const QModelIndex &amp;parent).</p>
<!-- @@@removeColumns -->
<!-- $$$removeRows[overload1]$$$removeRowsintintconstQModelIndex& -->
<h3 class="fn" id="removeRows"><a name="removeRows"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">removeRows</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex())</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#removeRows">QAbstractItemModel::removeRows</a>(int row, int count, const QModelIndex &amp;parent).</p>
<!-- @@@removeRows -->
<!-- $$$rowCount[overload1]$$$rowCountconstQModelIndex& -->
<h3 class="fn" id="rowCount"><a name="rowCount"></a><code>[override virtual] </code><span class="type">int</span> QStandardItemModel::<span class="name">rowCount</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>parent</i> = QModelIndex()) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#rowCount">QAbstractItemModel::rowCount</a>(const QModelIndex &amp;parent) const.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setRowCount">setRowCount</a>().</p>
<!-- @@@rowCount -->
<!-- $$$setColumnCount[overload1]$$$setColumnCountint -->
<h3 class="fn" id="setColumnCount"><a name="setColumnCount"></a><span class="type">void</span> QStandardItemModel::<span class="name">setColumnCount</span>(<span class="type">int</span> <i>columns</i>)</h3>
<p>Sets the number of columns in this model to <i>columns</i>. If this is less than <a href="qstandarditemmodel.html#columnCount">columnCount</a>(), the data in the unwanted columns is discarded.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#columnCount">columnCount</a>() and <a href="qstandarditemmodel.html#setRowCount">setRowCount</a>().</p>
<!-- @@@setColumnCount -->
<!-- $$$setData[overload1]$$$setDataconstQModelIndex&constQVariant&int -->
<h3 class="fn" id="setData"><a name="setData"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">setData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &amp;<i>value</i>, <span class="type">int</span> <i>role</i> = Qt::EditRole)</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#setData">QAbstractItemModel::setData</a>(const QModelIndex &amp;index, const QVariant &amp;value, int role).</p>
<p><b>See also </b><a href="qstandarditemmodel.html#data">data</a>().</p>
<!-- @@@setData -->
<!-- $$$setHeaderData[overload1]$$$setHeaderDataintQt::OrientationconstQVariant&int -->
<h3 class="fn" id="setHeaderData"><a name="setHeaderData"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">setHeaderData</span>(<span class="type">int</span> <i>section</i>, <span class="type"><a href="../qtcore/qt.html#Orientation-enum">Qt::Orientation</a></span> <i>orientation</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &amp;<i>value</i>, <span class="type">int</span> <i>role</i> = Qt::EditRole)</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#setHeaderData">QAbstractItemModel::setHeaderData</a>(int section, Qt::Orientation orientation, const QVariant &amp;value, int role).</p>
<p><b>See also </b><a href="qstandarditemmodel.html#headerData">headerData</a>().</p>
<!-- @@@setHeaderData -->
<!-- $$$setHorizontalHeaderItem[overload1]$$$setHorizontalHeaderItemintQStandardItem* -->
<h3 class="fn" id="setHorizontalHeaderItem"><a name="setHorizontalHeaderItem"></a><span class="type">void</span> QStandardItemModel::<span class="name">setHorizontalHeaderItem</span>(<span class="type">int</span> <i>column</i>, <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>Sets the horizontal header item for <i>column</i> to <i>item</i>. The model takes ownership of the item. If necessary, the column count is increased to fit the item. The previous header item (if there was one) is deleted.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#horizontalHeaderItem">horizontalHeaderItem</a>(), <a href="qstandarditemmodel.html#setHorizontalHeaderLabels">setHorizontalHeaderLabels</a>(), and <a href="qstandarditemmodel.html#setVerticalHeaderItem">setVerticalHeaderItem</a>().</p>
<!-- @@@setHorizontalHeaderItem -->
<!-- $$$setHorizontalHeaderLabels[overload1]$$$setHorizontalHeaderLabelsconstQStringList& -->
<h3 class="fn" id="setHorizontalHeaderLabels"><a name="setHorizontalHeaderLabels"></a><span class="type">void</span> QStandardItemModel::<span class="name">setHorizontalHeaderLabels</span>(const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>labels</i>)</h3>
<p>Sets the horizontal header labels using <i>labels</i>. If necessary, the column count is increased to the size of <i>labels</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setHorizontalHeaderItem">setHorizontalHeaderItem</a>().</p>
<!-- @@@setHorizontalHeaderLabels -->
<!-- $$$setItem[overload1]$$$setItemintintQStandardItem* -->
<h3 class="fn" id="setItem"><a name="setItem"></a><span class="type">void</span> QStandardItemModel::<span class="name">setItem</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>Sets the item for the given <i>row</i> and <i>column</i> to <i>item</i>. The model takes ownership of the item. If necessary, the row count and column count are increased to fit the item. The previous item at the given location (if there was one) is deleted.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#item">item</a>().</p>
<!-- @@@setItem -->
<!-- $$$setItem$$$setItemintQStandardItem* -->
<h3 class="fn" id="setItem-1"><a name="setItem-1"></a><span class="type">void</span> QStandardItemModel::<span class="name">setItem</span>(<span class="type">int</span> <i>row</i>, <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>This is an overloaded function.</p>
<!-- @@@setItem -->
<!-- $$$setItemData[overload1]$$$setItemDataconstQModelIndex&constQMap<int,QVariant>& -->
<h3 class="fn" id="setItemData"><a name="setItemData"></a><code>[override virtual] </code><span class="type">bool</span> QStandardItemModel::<span class="name">setItemData</span>(const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>index</i>, const <span class="type"><a href="../qtcore/qmap.html">QMap</a></span>&lt;<span class="type">int</span>, <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span>&gt; &amp;<i>roles</i>)</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#setItemData">QAbstractItemModel::setItemData</a>(const QModelIndex &amp;index, const QMap&lt;int, QVariant&gt; &amp;roles).</p>
<p><b>See also </b><a href="qstandarditemmodel.html#itemData">itemData</a>().</p>
<!-- @@@setItemData -->
<!-- $$$setItemPrototype[overload1]$$$setItemPrototypeconstQStandardItem* -->
<h3 class="fn" id="setItemPrototype"><a name="setItemPrototype"></a><span class="type">void</span> QStandardItemModel::<span class="name">setItemPrototype</span>(const <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>Sets the item prototype for the model to the specified <i>item</i>. The model takes ownership of the prototype.</p>
<p>The item prototype acts as a <a href="qstandarditem.html">QStandardItem</a> factory, by relying on the <a href="qstandarditem.html#clone">QStandardItem::clone</a>() function. To provide your own prototype, subclass <a href="qstandarditem.html">QStandardItem</a>, reimplement <a href="qstandarditem.html#clone">QStandardItem::clone</a>() and set the prototype to be an instance of your custom class. Whenever <a href="qstandarditemmodel.html">QStandardItemModel</a> needs to create an item on demand (for instance, when a view or item delegate calls <a href="qstandarditemmodel.html#setData">setData</a>())), the new items will be instances of your custom class.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#itemPrototype">itemPrototype</a>() and <a href="qstandarditem.html#clone">QStandardItem::clone</a>().</p>
<!-- @@@setItemPrototype -->
<!-- $$$setItemRoleNames[overload1]$$$setItemRoleNamesconstQHash<int,QByteArray>& -->
<h3 class="fn" id="setItemRoleNames"><a name="setItemRoleNames"></a><span class="type">void</span> QStandardItemModel::<span class="name">setItemRoleNames</span>(const <span class="type"><a href="../qtcore/qhash.html">QHash</a></span>&lt;<span class="type">int</span>, <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span>&gt; &amp;<i>roleNames</i>)</h3>
<p>Sets the item role names to <i>roleNames</i>.</p>
<!-- @@@setItemRoleNames -->
<!-- $$$setRowCount[overload1]$$$setRowCountint -->
<h3 class="fn" id="setRowCount"><a name="setRowCount"></a><span class="type">void</span> QStandardItemModel::<span class="name">setRowCount</span>(<span class="type">int</span> <i>rows</i>)</h3>
<p>Sets the number of rows in this model to <i>rows</i>. If this is less than <a href="qstandarditemmodel.html#rowCount">rowCount</a>(), the data in the unwanted rows is discarded.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#rowCount">rowCount</a>() and <a href="qstandarditemmodel.html#setColumnCount">setColumnCount</a>().</p>
<!-- @@@setRowCount -->
<!-- $$$setVerticalHeaderItem[overload1]$$$setVerticalHeaderItemintQStandardItem* -->
<h3 class="fn" id="setVerticalHeaderItem"><a name="setVerticalHeaderItem"></a><span class="type">void</span> QStandardItemModel::<span class="name">setVerticalHeaderItem</span>(<span class="type">int</span> <i>row</i>, <span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *<i>item</i>)</h3>
<p>Sets the vertical header item for <i>row</i> to <i>item</i>. The model takes ownership of the item. If necessary, the row count is increased to fit the item. The previous header item (if there was one) is deleted.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#verticalHeaderItem">verticalHeaderItem</a>(), <a href="qstandarditemmodel.html#setVerticalHeaderLabels">setVerticalHeaderLabels</a>(), and <a href="qstandarditemmodel.html#setHorizontalHeaderItem">setHorizontalHeaderItem</a>().</p>
<!-- @@@setVerticalHeaderItem -->
<!-- $$$setVerticalHeaderLabels[overload1]$$$setVerticalHeaderLabelsconstQStringList& -->
<h3 class="fn" id="setVerticalHeaderLabels"><a name="setVerticalHeaderLabels"></a><span class="type">void</span> QStandardItemModel::<span class="name">setVerticalHeaderLabels</span>(const <span class="type"><a href="../qtcore/qstringlist.html">QStringList</a></span> &amp;<i>labels</i>)</h3>
<p>Sets the vertical header labels using <i>labels</i>. If necessary, the row count is increased to the size of <i>labels</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setVerticalHeaderItem">setVerticalHeaderItem</a>().</p>
<!-- @@@setVerticalHeaderLabels -->
<!-- $$$sibling[overload1]$$$siblingintintconstQModelIndex& -->
<h3 class="fn" id="sibling"><a name="sibling"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QStandardItemModel::<span class="name">sibling</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, const <span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> &amp;<i>idx</i>) const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#sibling">QAbstractItemModel::sibling</a>(int row, int column, const QModelIndex &amp;index) const.</p>
<!-- @@@sibling -->
<!-- $$$sort[overload1]$$$sortintQt::SortOrder -->
<h3 class="fn" id="sort"><a name="sort"></a><code>[override virtual] </code><span class="type">void</span> QStandardItemModel::<span class="name">sort</span>(<span class="type">int</span> <i>column</i>, <span class="type"><a href="../qtcore/qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i> = Qt::AscendingOrder)</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#sort">QAbstractItemModel::sort</a>(int column, Qt::SortOrder order).</p>
<!-- @@@sort -->
<!-- $$$supportedDropActions[overload1]$$$supportedDropActions -->
<h3 class="fn" id="supportedDropActions"><a name="supportedDropActions"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qt.html#DropAction-enum">Qt::DropActions</a></span> QStandardItemModel::<span class="name">supportedDropActions</span>() const</h3>
<p>Reimplements: <a href="../qtcore/qabstractitemmodel.html#supportedDropActions">QAbstractItemModel::supportedDropActions</a>() const.</p>
<p><a href="qstandarditemmodel.html">QStandardItemModel</a> supports both copy and move.</p>
<!-- @@@supportedDropActions -->
<!-- $$$takeColumn[overload1]$$$takeColumnint -->
<h3 class="fn" id="takeColumn"><a name="takeColumn"></a><span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; QStandardItemModel::<span class="name">takeColumn</span>(<span class="type">int</span> <i>column</i>)</h3>
<p>Removes the given <i>column</i> without deleting the column items, and returns a list of pointers to the removed items. The model releases ownership of the items. For items in the column that have not been set, the corresponding pointers in the list will be <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#takeRow">takeRow</a>().</p>
<!-- @@@takeColumn -->
<!-- $$$takeHorizontalHeaderItem[overload1]$$$takeHorizontalHeaderItemint -->
<h3 class="fn" id="takeHorizontalHeaderItem"><a name="takeHorizontalHeaderItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">takeHorizontalHeaderItem</span>(<span class="type">int</span> <i>column</i>)</h3>
<p>Removes the horizontal header item at <i>column</i> from the header without deleting it, and returns a pointer to the item. The model releases ownership of the item.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#horizontalHeaderItem">horizontalHeaderItem</a>() and <a href="qstandarditemmodel.html#takeVerticalHeaderItem">takeVerticalHeaderItem</a>().</p>
<!-- @@@takeHorizontalHeaderItem -->
<!-- $$$takeItem[overload1]$$$takeItemintint -->
<h3 class="fn" id="takeItem"><a name="takeItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">takeItem</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i> = 0)</h3>
<p>Removes the item at (<i>row</i>, <i>column</i>) without deleting it. The model releases ownership of the item.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#item">item</a>(), <a href="qstandarditemmodel.html#takeRow">takeRow</a>(), and <a href="qstandarditemmodel.html#takeColumn">takeColumn</a>().</p>
<!-- @@@takeItem -->
<!-- $$$takeRow[overload1]$$$takeRowint -->
<h3 class="fn" id="takeRow"><a name="takeRow"></a><span class="type">QList</span>&lt;<span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *&gt; QStandardItemModel::<span class="name">takeRow</span>(<span class="type">int</span> <i>row</i>)</h3>
<p>Removes the given <i>row</i> without deleting the row items, and returns a list of pointers to the removed items. The model releases ownership of the items. For items in the row that have not been set, the corresponding pointers in the list will be <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#takeColumn">takeColumn</a>().</p>
<!-- @@@takeRow -->
<!-- $$$takeVerticalHeaderItem[overload1]$$$takeVerticalHeaderItemint -->
<h3 class="fn" id="takeVerticalHeaderItem"><a name="takeVerticalHeaderItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">takeVerticalHeaderItem</span>(<span class="type">int</span> <i>row</i>)</h3>
<p>Removes the vertical header item at <i>row</i> from the header without deleting it, and returns a pointer to the item. The model releases ownership of the item.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#verticalHeaderItem">verticalHeaderItem</a>() and <a href="qstandarditemmodel.html#takeHorizontalHeaderItem">takeHorizontalHeaderItem</a>().</p>
<!-- @@@takeVerticalHeaderItem -->
<!-- $$$verticalHeaderItem[overload1]$$$verticalHeaderItemint -->
<h3 class="fn" id="verticalHeaderItem"><a name="verticalHeaderItem"></a><span class="type"><a href="qstandarditem.html">QStandardItem</a></span> *QStandardItemModel::<span class="name">verticalHeaderItem</span>(<span class="type">int</span> <i>row</i>) const</h3>
<p>Returns the vertical header item for row <i>row</i> if one has been set; otherwise returns <code>nullptr</code>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also </b><a href="qstandarditemmodel.html#setVerticalHeaderItem">setVerticalHeaderItem</a>() and <a href="qstandarditemmodel.html#horizontalHeaderItem">horizontalHeaderItem</a>().</p>
<!-- @@@verticalHeaderItem -->
</div>
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
